package com.wanczy.dao.proxy;

import java.sql.Connection;

import org.apache.commons.dbutils.DbUtils;
import com.wanczy.dao.UserTableDaoSingle;
import com.wanczy.dao.impl.UserTableDAOImpl;
import com.wanczy.pojo.UserTable;
import com.wanczy.util.GetDBConnection;


public class UserTableDAOSingleProxy implements UserTableDaoSingle{
	public Connection conn;
	public UserTableDAOImpl impl = null;
	public UserTableDAOSingleProxy() {
		try {
			this.conn = GetDBConnection.getConnection();// 取得数据库连接
			this.impl = new UserTableDAOImpl(this.conn);
		} catch (Exception e) {
			e.printStackTrace();
		}	
	}
	@Override
	public UserTable findById(int userId) {
		UserTable userTable = this.impl.findById(userId);
		DbUtils.commitAndCloseQuietly(conn);		
		return userTable;
	}
	@Override
	public boolean doUpd(UserTable userTable) {
		boolean flag = this.impl.doUpd(userTable);
		DbUtils.commitAndCloseQuietly(conn);
		return flag;
	}

	
}
